import java.util.Scanner;

/**
 * @Author YuanYuan
 * @Date 2022/4/27
 * @Time 12:13
 */
public class TestDemo {
    public static void twoSingleDog(int[] arr) {
        int ret = 0;
        for (int i = 0; i < arr.length; i++) {
            ret ^= arr[i];
        }
        int sum = 0;
        for (sum = 0; sum < 32; sum++) {
            //找到二进制位最后一个1的位置
            if(1 == ((ret>>sum)&1)) {
                break;
            }
        }
        int num1 = 0;
        for (int i = 0; i < arr.length; i++) {
            if(1 == ((arr[i]>>sum)&1)) {
                num1 ^= arr[i];
            }
        }
        int num2 = ret^num1;
        System.out.println("单身狗1号："+num1+" 单身狗2号："+num2);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] ret = str.split(" ");
        int[] arr = new int[ret.length];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = Integer.parseInt(ret[i]);
        }
        twoSingleDog(arr);
    }
}